<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>{course_desc}</title>
<link rel="shortcut icon" href="{dir_image}favicon.ico">
<link rel="stylesheet" type="text/css" href="{dir_css}Popup.css" />
<script type="text/javascript" src="{dir_js}jquery.min.js"></script>
<script type="text/javascript">
	
	$(document).ready(function() {
		if ($('#if_display').val() == 1) {
			parent.window.location.href = parent.window.location.href;
		}
		if ($('#w_error').val() > 0) {
			$('#d_error').text('Please fill up all the Required Field');
		}
	});
	
	function sectionList() {
		$('#txtsubj').val('');
		$('#subj_check').hide();
	}
	
	function subjList() {
		var txtsubj = $('#txtsubj option:selected').val();
		var txtsec = $('#txtsection option:selected').val();
		
		if ( txtsec != '' || txtsec > 0 ) {
			$.post('request.php', {AJAXPost:'SubjectSchedulingSelected', stid:$('#stid').val(), prof_subj_id:txtsubj, prof_id:$('#fid').val(), section_id:txtsec, year_id:$('#year_id').val()}, function(res) {
				
				$('#subj_check').show();
				
				if (res.lec <= 0 || res.lec == null) {
					resLec = 0;
					$('#img_lec').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
				}
				else {
					resLec = res.lec;
					if ( res.hrs <= res.lec ) {
						$('#img_lec').attr({'src':'{dir_image}icon/checkbox_uncheck.png', 'onclick':'lecLabVal(0);'}).addClass('cursor-pointer');
					}
					else {
						$('#img_lec').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
					}
				}
				
				
				if (res.lab <= 0 || res.lab == null) {
					resLab = 0;
					$('#img_lab').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
				}
				else {
					resLab = res.lab;
					if ( res.hrs <= res.lab ) {
						$('#img_lab').attr({'src':'{dir_image}icon/checkbox_uncheck.png', 'onclick':'lecLabVal(1);'}).addClass('cursor-pointer');
					}
					else {
						$('#img_lab').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
					}
				}
				
				if (res.lec_lab <= 0 || res.lec_lab == null) {
					resLecLab = 0;
					$('#img_lec_lab').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
				}
				else {
					resLecLab = res.lec_lab;
					if ( res.hrs <= res.lec_lab ) {
						$('#img_lec_lab').attr({'src':'{dir_image}icon/checkbox_uncheck.png', 'onclick':'lecLabVal(2);'}).addClass('cursor-pointer');
					}
					else {
						$('#img_lec_lab').attr({'src':'{dir_image}icon/checkbox_remove.png', 'onclick':''}).removeClass('cursor-pointer');
					}
				}
				
				
				$('#lec_value').text('(' + resLec + ')');
				$('#lab_value').text('(' + resLab + ')');
				$('#lec_lab_val').text('(' + resLecLab + ')');
				
			}, 'json');
		}
		else {
			alert("Please select what section you want to schedule.");
		}
	}
	
	function lecLabVal(strValue) {
		$('#lec_lab_value').val(strValue);
		
		switch (strValue) {
			case 0: $('#img_lec').attr('src', '{dir_image}icon/checkbox_check.png');
					if ($('#img_lab').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lab').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					if ($('#img_lec_lab').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lec_lab').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					break;
					
			case 1: $('#img_lab').attr('src', '{dir_image}icon/checkbox_check.png');
					if ($('#img_lec').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lec').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					if ($('#img_lec_lab').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lec_lab').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					break;
					
			case 2: $('#img_lec_lab').attr('src', '{dir_image}icon/checkbox_check.png');
					if ($('#img_lec').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lec').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					if ($('#img_lab').attr('src') != '{dir_image}icon/checkbox_remove.png')  $('#img_lab').attr('src', '{dir_image}icon/checkbox_uncheck.png');
					break;
		}
		
	}
	
</script>
	
</head>
<body>
	<div class="subject-taken-label">{prof_name}</div>
	<input type="hidden" id="if_display" value="{if_display}"/>
	<input type="hidden" id="w_error" value="{w_error}"/>
	<input type="hidden" id="fid" value="{fid}"/>
	<input type="hidden" id="year_id" value="{year_id}"/>
	<form method="post" enctype="multipart/form-data" action="">
	<input type="hidden" id="stid" name="stid" value="{stid}"/>
		<table width="0" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="70" height="25" class="subject-taken-value-line"><strong>TIME:</strong></td>
				<td width="100" class="subject-taken-value-line"><strong>{day}</strong></td>
				<td width="130" class="subject-taken-value-line"><strong>{from} - {to}</strong></td>
				<td width="300" class="subject-taken-value-line"><strong>{hrs} Hours</strong></td>
			</tr>
		</table>
		<br />
		<table width="0" border="0" cellspacing="0" cellpadding="0">
			<tr>
				<td width="90" height="1"></td>
				<td width="20"></td>
				<td width="560"><span class="required-field" id="d_error"></span></td>
			</tr>
			<tr>
				<td width="70" height="30"><strong>SECTION</strong><span class="required-field">*</span></td>
				<td width="20">:</td>
				<td width="560">{section}</td>
			</tr>
			<tr>
				<td width="90" height="30"><strong>SUBJECT</strong><span class="required-field">*</span></td>
				<td width="20">:</td>
				<td width="560">
					{subj}
				</td>
			</tr>
			<tr id="subj_check" class="display-none">
				<td></td>
				<td></td>
				<td><input type="hidden" name="lec_lab_value" id="lec_lab_value"/>
					<table width="0" border="0" cellspacing="0" cellpadding="0">
						<tr valign="middle">
							<td height="20" width="16"><img src="./application/images/icon/checkbox_uncheck.png"  id="img_lec" border="0" class="cursor-pointer" onclick="lecLabVal('0');"/></td>
							<td width="100" class="color-blue">Lecture <span class="color-grey" id="lec_value"></span></td>
							<td width="16"><img src="./application/images/icon/checkbox_uncheck.png"  id="img_lab" border="0" class="cursor-pointer" onclick="lecLabVal('1');"/></td>
							<td width="120" class="color-blue">Laboratory <span class="color-grey" id="lab_value"></span></td>
							<td width="16"><img src="./application/images/icon/checkbox_uncheck.png" id="img_lec_lab" border="0" class="cursor-pointer" onclick="lecLabVal('2');"/></td>
							<td width="210" class="color-blue">Laboratory/Lecture <span class="color-grey" id="lec_lab_val"></span></td>
						</tr>
					</table>
				</td>
			</tr>
			<tr>
				<td width="70" height="30"><strong>ROOM</strong><span class="required-field">*</span></td>
				<td width="20">:</td>
				<td width="560">{room}</td>
			</tr>
			<tr valign="bottom">
				<td width="70" height="35"></td>
				<td width="20"></td>
				<td width="560"><input type="submit" name="subButton" class="submit-input" value="Save"/> <input type="button" onclick="parent.popupRequest('hide');" class="submit-input" value="Cancel"/></td>
			</tr>
		</table>
	</form>
</body>
</html>